package com.ext.aic.box;

import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;

public class SettingsHelper {
    public static boolean setAccessibilityService(Context context, String serviceName) {
        try {
            ContentResolver contentResolver = context.getContentResolver();
            // 将目标无障碍服务写入设置
            Settings.Secure.putString(contentResolver,
                    Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
                    serviceName);
            return true;
        } catch (SecurityException e) {
            e.printStackTrace();
            return false;
        }
    }
}
